package com.wyx.springvueadmin.mapper;

import com.wyx.springvueadmin.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface userMapper {
    @Select("SELECT * from sky_take_out.man where id=#{id}")
    User finById(Integer id);
    @Select("select * from sky_take_out.man")
    List<User> findAll();
    @Insert("insert into sky_take_out.man(no, name, password, age, sex, phone, role_id) " +
            "VALUES (#{no},#{name},#{password},#{age},#{sex},#{phone},#{roleId})")
    void save(User user);
    @Delete("delete from sky_take_out.man where id=#{id}")
    void delete(Integer id);
    @Update("update sky_take_out.man set no = #{no},name=#{name},password=#{password},age=#{age}," +
            "sex=#{sex},phone=#{phone},role_id=#{roleId} where id = #{id}")
    void change(User user);

    @Select("select * from sky_take_out.man")
    public List<User> page();
    @Select("select * from sky_take_out.man where sex=#{sex}")
    List<User> selectBySex(Integer sex);
}
